<%@page import="java.util.List"%>
<%@page import="entities.User"%>
<%@page import="auxilary.Actions"%>
<%@page import="auxilary.Constants"%>
<%@page import="entities.Course"%>
<%@page import="auxilary.Links"%>
<%@page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<%
	User user = (User)request.getSession().getAttribute("user");
	boolean hasCourses = (Boolean)request.getAttribute("hasCourses");
	List<String> styles = (List<String>)request.getAttribute("styles");
%>
<jsp:include page="/frames/start.jsp" />
	<%=Links.Css.SCHEDULE %>
	<%=Links.Scripts.USER %>
	<%=Links.Scripts.SCHEDULE %>
<jsp:include page="/frames/frame.jsp" />
			<h1>My Schedule</h1>
		  <% if (!hasCourses) { %>
		   	<center><h4>You are not registered to any courses<br /><br />Find courses <a href="<%=Links.Pages.SEARCH %>">here</a></h4></center>
		  <% } else { %>
			<input type="hidden" id="action" value="<%=Actions.User.GET_SCHEDULE %>">
			<input type="hidden" value="<%=Actions.User.DELETE_STYLE %>" id="delete-action" />
			<div class="tops">
				<form id="filters" action="">
			   		<input type="hidden" value="<%=Actions.Course.COURSES_VIEW %>" name="action" />
			   		<b>Choose a style:</b> 
			   		<select id="style">
			   		   <% for (String style : styles) { %>
			   			<option value="<%=style %>"><%=style.replace("."," ") %></option>
			   		   <% } %>
			   		</select>
			   	   <% if ((user != null) && (user.isAdmin())) { %>
			   		&nbsp;&nbsp;&nbsp;
			   		<small><a href="javascript:deleteStyle()" id="delete">delete?</a></small>
			   	   <% } %>
			   	   	<center><div id="delete-error" class="error"></div></center>
		   		</form>
		   	</div>
		   	<br />
			<div id="schedule-box"></div>
		  <% } %>
			<br /><br />
		  <% if ((user != null) && (user.isAdmin())) { %>
			<form action="<%=Links.PROJECT_BASE%>Upload" enctype="multipart/form-data" method="POST" class="upload-box">
				<h1>Upload New Style</h1>
				<input type="file" name="file1"><br>
				<input type="Submit" value="Upload" onclick="upload()"><br>
			</form>

		  <% } %>
		  <% if (hasCourses) { %>
			<a href="xml" class="xml-link">See xml of schedule</a>
	 	  <% } %>
		  
<jsp:include page="/frames/end.jsp" />